<?php

class Application_Form_Addproject extends Zend_Form
{        
    public function init() 
    {
       // $translate = new My_Action_Helper_Lang();
        
        $this->setName('add_project');
	$name = new Zend_Form_Element_Text('name');
      //  $username->setLabel($translate->_('Email'))
	$name->setLabel('name')
                 ->setRequired(true)	            
                 ->addValidator('NotEmpty');
	      
	$type = new Zend_Form_Element_Text('type');
//	$password->setLabel($translate->_('Password'))
        $type->setLabel('type')                 
	         ->setRequired(true)
	         ->addValidator('NotEmpty');
        
        $date = new Zend_Form_Element_Text('date');
//	$password->setLabel($translate->_('Password'))
        $date->setLabel('date')                 
	         ->setRequired(true)
	         ->addValidator('NotEmpty') 
                 ->addFilter('StripTags')
	         ->addFilter('StringTrim');
        
        $category = new Zend_Form_Element_Select('category');
        $table = new Application_Model_Category();
        //добавляем опции в форму
        $category->setLabel('Categories');
        //массивом передаем значения в select
        foreach ($table->getAllCategories() as $table) {
            $category->addMultiOption($table['id'], $table['name']);
        }
        
        $client_name = new Zend_Form_Element_Text('client_name');
//	$password->setLabel($translate->_('Password'))
        $client_name->setLabel('client name')                 
	         ->setRequired(true)
	         ->addValidator('NotEmpty') 
                 ->addFilter('StripTags')
	         ->addFilter('StringTrim');
        
        $url = new Zend_Form_Element_Text('url');
//	$password->setLabel($translate->_('Password'))
        $url->setLabel('url')                 
	         ->setRequired(true)
	         ->addValidator('NotEmpty') 
                 ->addFilter('StripTags')
	         ->addFilter('StringTrim');
        
        $text = new Zend_Form_Element_Textarea('text');
//	$password->setLabel($translate->_('Password'))
        $text->setLabel('about')                 
	         ->setRequired(true)
	         ->addValidator('NotEmpty');
        
        $small_img = new Zend_Form_Element_File('icon');
        $small_img->setLabel('Preview small image')
                  ->addValidator('Size', false, 1024000)
                  ->addValidator('Extension', false, 'jpg,png,gif');
        
        $big_img = new Zend_Form_Element_File('big_icon');
        $big_img->setLabel('Preview big image')
                  ->addValidator('Size', false, 1024000)
                  ->addValidator('Extension', false, 'jpg,png,gif');
        
                //->addValidator(new Application_Plugin_PasswordStrength());
        
        $additional = new Zend_Form_Element_File('additional');
        $additional->setLabel('Additional images')
                  ->addValidator('Size', false, 1024000)
                  ->setMultiFile(10)
                  ->addValidator('Extension', false, 'jpg,png,gif');
        
	         
	$submit = new Zend_Form_Element_Submit('submit');
//	$submit->setLabel($translate->_('Login'));
        $submit->setLabel('Add project');
	         
        $this->addElements(array($name, $type, $category, $date, $client_name, $url, $small_img, $big_img, $additional, $text, $submit));	         
	$this->setMethod('post');
    }


}

